import { createRouter, createWebHashHistory } from 'vue-router'
const Layout = () => import('@/views/Layout')
const Home = () => import('@/views/home/index')
const routes = [
  // {
  //   path: '/about',
  //   name: 'About',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  // }
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '/',
        name: 'Home',
        component: Home
      },
      {
        path: '/category/:id',
        name: 'category',
        component: () => import(/* webpackChunkName: "about" */ '../views/category')
      },
      {
        path: '/category/sub/:id',
        name: 'SubCategory',
        component: () => import(/* webpackChunkName: "about" */ '../views/category/sub.vue')
      },
      {
        path: '/goods/:id',
        name: 'goods',
        component: () => import(/* webpackChunkName: "about" */ '../views/goods/index.vue')
      },
      {
        path: '/cart',
        name: 'cart',
        component: () => import(/* webpackChunkName: "about" */ '../views/cart/index.vue')
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import(/* webpackChunkName: "login" */ '../views/Login/index.vue')
  },
  {
    path: '/login/callback',
    name: 'PageCallback',
    component: () => import(/* webpackChunkName: "login/callback" */ '../views/Login/callback.vue')
  },
  {
    path: '/playground',
    name: 'playground',
    component: () => import(/* webpackChunkName: "about" */ '../views/playground')

  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
